
<div class="container" ng-app="schedulesApp">    
    <div class="row" >
        <div class="blockGray">
            <div class="blockInner">
                <ng-view></ng-view>
            </div>
        </div>        
    </div>    
   
    <!--  Definición de vistas parciales -->
    <script type="text/ng-template" id="index.html">       
        <progressbar class="progress-striped active" value="100" type="info" ng-show="loading"></progressbar>
            <div class="toolbar">
                <div class="col-md-7">
                    &nbsp;
                </div>
                <div class="col-md-5 ">
                    <div class="pull-right">
                        <div class="btn-toolbar" role="toolbar">
                            <div class="btn-group  btn-group-sm">
                                <button class="btn btn-default" ng-click="go('/index')"><span class="glyphicon glyphicon-home"></span> Inicio</button>
                                <button class="btn btn-default" ng-click="go('/add')"><span class="glyphicon glyphicon-plus-sign"></span> Nuevo</button>
                                <button class="btn btn-default" ng-click="goEdit('/edit/'+scheduleId)"><span class="glyphicon glyphicon-edit"></span> Editar</button>
                                <button class="btn btn-default" ng-click="delete(scheduleId)"><span class="glyphicon glyphicon-trash"></span> Eliminar</button>
                                <button class="btn btn-default" ng-click="refresh()"><span class="glyphicon glyphicon-refresh"></span> Actualizar</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        
        <br>
        <ng-jqgrid vapi="grid.apicall" config="grid.config" api="grid.api" gridid="grdSchedules" pagerid="schedulesPager"></ng-jqgrid>
    </script>
    
    <script type="text/ng-template" id="edit.html">        
    <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</alert>
    <progressbar class="progress-striped active" value="100" type="info" ng-show="sc.loading"></progressbar>
  
    <div class="toolbar">
        <div class="col-md-7">
            &nbsp;
        </div>
        <div class="col-md-5 ">
            <div class="pull-right">
                <div class="btn-toolbar" role="toolbar">
                    <div class="btn-group  btn-group-sm">
                        <a href="#!/index" class="btn btn-default" role="button"><span class="glyphicon glyphicon-home"></span> Inicio</a>
                        <button class="btn btn-default" ng-click="save()" ng-disabled="sc.frmSchedule.$invalid"><span class="glyphicon glyphicon-floppy-save"></span> Guardar</button>
                        <button class="btn btn-default" ng-click="go('/add')"><span class="glyphicon glyphicon-plus-sign"></span> Nuevo</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <br>

   <div class="panel panel-default">
       <div class="panel-heading">
           Programaci&oacute;n de rutas
       </div> 
        <div class="panel-body">
            <form role="form" novalidate name="sc.frmSchedule">
                <div class="row">
                    <div class="col-md-5">
                        <div class="form-group">
                            <label for="route_id">Ruta</label>
                            <div class="input-group">
                                <span class="input-group-addon">{{schedule.route}}</span>
                                <div angucomplete id="route_id"
                                    placeholder="Buscar ruta"
                                    pause="400"
                                    selectedobject="sc.cboRoutes.selectedObject"
                                    url="{{routeContextPath}}getRouteCatalog"
                                    datafield="0"
                                    titlefield="route"
                                    descriptionfield=""
                                    inputclass="form-control"/>
                           </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="status" ng-model="schedule.status"  ng-true-value="1" ng-false-value="0" >
                                Programaci&oacute;n activa
                            </label>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="week" ng-model="schedule.week"  ng-true-value="1" ng-false-value="0" >
                                Programaci&oacute;n semanal
                            </label>
                        </div>
                    </div>
                </div>
        
                <div class="row">
                    <div class="col-md-5">
                        <div class="form-group">
                            <label for="vehicle_id">Veh&iacute;culo</label>
                            <div class="input-group">
                                <span class="input-group-addon">{{schedule.vehicle}}</span>
                                <div angucomplete id="vehicle_id"
                                    placeholder="Buscar veh&iacute;culo"
                                    pause="400"
                                    selectedobject="sc.cboVehicles.selectedObject"
                                    url="{{vehicleContextPath}}getVehicleCatalog"
                                    datafield="0"
                                    titlefield="name"
                                    descriptionfield=""
                                    inputclass="form-control"/>
                           </div>
                        </div>
                    </div>
                    <div class="col-md-3">                    
                        <input type="hidden" class="form-control" ng-model="schedule.id">
                        <label for="date">Fecha</label>
                        <div class="input-group">
                                <input type="text" class="form-control" id="date" name="date" placeholder="" ng-model="sc.dt" datepicker-popup="{{datePicker.format}}" 
                                       is-open="datePicker.opened" min-date="datePicker.minDate" max-date="'2015-06-22'" datepicker-options="datePicker.dateOptions" ng-required="true" close-text="Cerrar" current-text="Hoy" clear-text="Borrar"/>
                                <span class="input-group-btn">
                                <button type="button" class="btn btn-default" ng-click="datePicker.open($event)">&nbsp;<i class="glyphicon glyphicon-calendar"></i>&nbsp;</button>
                                </span>                                        
                        </div>
                    </div>
                    <div class="col-md-3">
                        
                    </div>
                </div>
                <div class="row">                            
                    <div class="col-md-5">
                        <div class="form-group">
                            <label for="user_id">Conductor</label>
                            <div class="input-group">
                                <span class="input-group-addon">{{schedule.driver}}</span>
                                <div angucomplete id="user_id"
                                    placeholder="Buscar conductor"
                                    pause="400"
                                    selectedobject="sc.cboUsers.selectedObject"
                                    url="{{userContextPath}}getUserCatalog"
                                    datafield="0"
                                    titlefield="driver"
                                    descriptionfield=""
                                    inputclass="form-control"/>                                
                           </div>
                        </div>                        
                    </div>                                
                    <div class="col-md-3">
                        <label for="time">Hora</label>
                        <timepicker ng-model="sc.dt" id="time" name="time"  hour-step="1" minute-step="15" show-meridian="false"></timepicker>
                    </div>
                    <div class="col-md-3">
                        <label>Repetir el:</label>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="monday" ng-model="schedule.monday"  ng-true-value="1" ng-false-value="0" >
                                Lunes
                            </label>
                        </div>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="tuesday" ng-model="schedule.tuesday" ng-true-value="1" ng-false-value="0" >
                                Martes
                            </label>
                        </div>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="wednesday" ng-model="schedule.wednesday" ng-true-value="1" ng-false-value="0" >
                                Mi&eacute;rcoles
                            </label>
                        </div>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="thursday" ng-model="schedule.thursday" ng-true-value="1" ng-false-value="0" >
                                Jueves
                            </label>
                        </div>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="friday" ng-model="schedule.friday" ng-true-value="1" ng-false-value="0" >
                                Viernes
                            </label>
                        </div>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="saturday" ng-model="schedule.saturday" ng-true-value="1" ng-false-value="0" >
                                S&aacute;bado
                            </label>
                        </div>                                
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" name="sunday" ng-model="schedule.sunday" ng-true-value="1" ng-false-value="0" >
                                Domingo
                            </label>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-5">
                        
                    </div>
                    <div class="col-md-3">                                                     
                    </div>
                </div>
                <div class="row">                            
                    <div class="col-md-3">
                    </div>
                </div>
                <div class="col-md-6">                                                     
                </div>
            </form>           
        </div>
   </div> 
    </script>
        
    <script type="text/ng-template" id="modal.html">
        <!-- <div class="modal-header">
            <h3>{{modalOptions.headerText}}</h3>
        </div>-->
        <div class="modal-body">
            <br/>
            <p>{{modalOptions.bodyText}}</p>
            <br/>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-warning" 
                    data-ng-click="modalOptions.close()">{{modalOptions.closeButtonText}}</button>
            <button type="button" class="btn btn-primary" 
                    data-ng-click="modalOptions.ok();">{{modalOptions.actionButtonText}}</button>
        </div>
    </script>
     
    
    <script type="text/ng-template" id="modalInfo.html">
        <!--<div class="modal-header">
            <h3>{{modalOptions.headerText}}</h3>
        </div>-->
        <div class="modal-body">
            <br/>
            <p>{{modalOptions.bodyText}}</p>
            
        </div>
        <div class="modal-footer">           
            <button type="button" class="btn btn-primary" 
                    data-ng-click="modalOptions.ok();">{{modalOptions.actionButtonText}}</button>
        </div>
    </script>
    
</div>